//
//  OADSectionConfig.m
//  OASDK_Works
//
//  Created by ChenJie on 3/1/20.
//  Copyright © 2020 Mist. All rights reserved.
//

#import "OADSectionConfig.h"

@interface OADSectionConfig ()

@end

@implementation OADSectionConfig

#pragma mark - Lifecycle methods

- (instancetype)init {
    self = [super init];
    if (self) {
    }
    return self;
}

#pragma mark - Public methods

- (OADCellConfig *)cellConfigAtIndex:(NSInteger)cellIndex {
    if (self.cells.count <= cellIndex) {
        return nil;
    }
    return self.cells[cellIndex];
}

/*
 * UITableViewDataSource
 */

- (NSInteger)numberOfRowsInSection {
    return self.cells.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndex:(NSInteger)cellIndex {
    OADCellConfig *cellConfig = [self cellConfigAtIndex:cellIndex];
    return [cellConfig cellForRowWithTableView:tableView];
}

/*
 * UITableViewDelegate
 */

- (CGFloat)heightForRowAtIndex:(NSInteger)cellIndex {
    OADCellConfig *cellConfig = [self cellConfigAtIndex:cellIndex];
    return [cellConfig heightForRow];
}

#pragma mark - Private methods



#pragma mark - Delegate methods



#pragma mark - Setter



#pragma mark - Getter

- (NSMutableArray<OADCellConfig *> *)cells {
    if (!_cells) {
        NSMutableArray *array = [NSMutableArray array];
        _cells = array;
    }
    return _cells;
}

#pragma mark - Memory management methods

- (void)dealloc {
}

@end
